﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Geometry {
    public struct Ray : IRay {
        public static float RAY_EPSILON = 1e-3f;

        public Point o;
        public Vector d;
        public float mint, maxt;
        public float time;

        public Point O { get { return o; } set { o = value; } }
        public Vector D { get { return d; } set { d = value; } }

        public float Mint { get { return mint; } set { mint = value; } }
        public float Maxt { get { return maxt; ;} set { maxt = value; } }
        public float Time { get { return time; } set { time = value; } }

        public Ray(Point origin, Vector direction) {
            this.o = origin;
            this.d = direction;
            this.mint = RAY_EPSILON;
            this.maxt = float.PositiveInfinity;
            this.time = 0.0f;
        }
        public Ray(Point origin, Vector direction,
            float start, float end, float t) {
            this.o = origin;
            this.d = direction;
            this.mint = start;
            this.maxt = end;
            this.time = t;
        }

        public Point point(float t) {
            return o + t * d;
        }
    }
}
